import { http } from '@/utils/http'

export const addToGardenAPI = (id, name) => {
  return http({
    method: 'POST',
    url: `/garden/${id}/${name}`,
  })
}

export const getGardenListAPI = () => {
  return http({
    method: 'GET',
    url: `/garden`,
  })
}

export const getSingleGardenAPI = (id) => {
  return http({
    method: 'GET',
    url: `/garden/${id}`,
  })
}

export const getNotesAPI = (id) => {
  return http({
    method: 'GET',
    url: `/garden/note/${id}`,
  })
}

export const deleteSingleGardenAPI = (id) => {
  return http({
    method: 'DELETE',
    url: `/garden/${id}`,
  })
}

export const getRemindAPI = (id, date) => {
  return http({
    method: 'GET',
    url: `/garden/remind/${id}`,
    data: { date },
  })
}

export const changeRemindListAPI = (remind) => {
  return http({
    method: 'POST',
    url: `/garden/remind`,
    data: remind,
  })
}

export const deleteSingleNoteAPI = (id) => {
  return http({
    method: 'DELETE',
    url: `/garden/note/${id}`,
  })
}

export const insertOrUpdateNoteWithoutImgAPI = (note) => {
  return http({
    method: 'POST',
    url: `/garden/note/oldImg`,
    data: note,
  })
}

export const searchByKeyWordAPI = (keyword) => {
  return http({
    method: 'GET',
    url: `/garden/search`,
    data: { keyword },
  })
}
